Electrical machines of today are mostly provided with cores made from laminated soft magnetic sheets or from soft magnetic powder which is compacted to the desired shape and density of the core and then heat treated. However, it may be difficult to produce a core with an optimal geometry, from a magnetic point of view, or a core with a geometry that varies in three dimensions by using laminated soft magnetic sheets. Even if the use of soft magnetic powder makes it possible to produce a core with a geometry that varies in three dimensions it may sometimes be impossible to produce a core having the optimal geometry. Therefore, it may be difficult to produce electrical machines having high power density, i.e. produced power divided with the volume of the machine, and, thus, the machines equipped with the core may not be quite as efficient as they could be.